﻿using System;

namespace Mediator.Framework.Runtime.Communication
{
    public interface IConnection:IDisposable
    {
        IProtocol Protocol
        { 
            get;
        }

        IEndpoint RemoteEndpoint
        {
            get;
        }

        IEndpoint LocalEndpoint
        {
            get;
        }

        /// <summary>
        /// Sending message async.
        /// </summary>
        /// <param name="message"></param>
        void SendMessageAsync(IMessageData message);

        /// <summary>
        /// Sending message sync.
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        IResponseMessage SendMessage(IMessageData message);
    }
}